<!-- Dom模板 -->
<template>
  <div id="box">
    <div class="header">
      <!-- iconfont -->
      <div class="top">
        <div @click="back">
          <i class="iconfont icon-lt"></i>
        </div>
        <!-- <p>
          <i class="iconfont icon-sandian"></i>
          <span></span>
          <i class="iconfont icon-xiaochengxu-guanbi1"></i>
        </p> -->
      </div>
    </div>
    <div class="main">
      <!-- 宝贝最爱标题 -->
      <div class="title">
        <img class="logo" src="../../../../static/img/图片 3@1x (1).png" />
        <img class="img" src="../../../../static/img/图片 2@1x (5).png" />
      </div>
      <!-- 内容 -->
      <div class="content">
        <!-- 胡杨 -->
        <div class="top">
          <img :src="$store.state.order.user.img" />
          <span>{{ $store.state.order.user.name }}</span>
        </div>
        <!-- 美可玩内容 -->
        <div class="center">
          <h4>美可玩故事</h4>
          <h5>每天听15分钟故事</h5>
          <h5>轻松成就孩子好品格、好习惯!</h5>
        </div>
        <!-- 二维码 -->
        <div class="bottom">
          <div>
            <p><i class="iconfont icon-weixin"></i></p>
            <span>分享给好友</span>
          </div>
          <div>
            <p><i class="iconfont icon-xiazai"></i></p>
            <span>保存到相册</span>
          </div>
          <div>
            <vue-qr :logoSrc="imageUrl" :text="getcode" :size="200"></vue-qr>
          </div>
          <!-- <img src="../../../../static/img/图片 2@1x (4).png" /> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import a from './a'; // 引入组件
import vueQr from "vue-qr";
export default {
  name: "qecode",

  data() {
    
    return {
       imageUrl: require("../../../assets/logo.png"),
      msg: "测试",
       text: {
        name: "小白",
        age: "22",
        sex: "男",
         code: "",
      },
      item:''
    };

    
  },
  components: {
    vueQr,
  },

   computed: {
    //   通过计算属性的方法 计算出需要的信息-- 计算属性个data声明的变量一样可以在文档中直接饮用
    getcode() {
      // 通过拼接展示 需要的信息
      let code =
        "姓名:" +
        this.text.name +
        ",年龄：" +
        this.text.age +
        ",性别：" +
        this.text.sex;
      this.code = code;
      return code;
    },
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {}, // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    this.item = JSON.parse(this.$route.query.episode);
  }, // Vue方法定义
  methods: {
    back() {
      this.$router.push({
        path: `/tgs`,
        query:{ episode: JSON.stringify(this.item) }
      });
    },
  },
};
</script>

<style scoped>
/* @import url(); 引入css类 */
@import url("../../../assets/font/iconfont.css");
#box {
  width: 100vw;
  height: 100vh;
  background: #ddb528;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
}
/* 头部 */
.header {
  width: 100vw;
  height: calc(196px * 0.82);
  padding-top: 55px;
}
/* iconfont */
.header .top {
  width: 100vw;
  height: 4px;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  align-items: center;
  vertical-align: middle;
}
.header .top .icon-lt {
  font-size: 24px;
  color: white;
  font-weight: bold;
}

.header .top p {
  width: 87px;
  height: 32px;
  line-height: 20px;
  border-radius: 30px;
  background-color: #ddb528;
  text-align: center;
  border: 1px solid rgba(255, 254, 254, 100);
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}
.header .top p span {
  border-right: 2px solid #e8e8e8;
  display: block;
  width: 1px;
  height: 18px;
}
.header .top p .icon-sandian {
  color: white;
  font-size: 20px;
  font-weight: bold;
}
.header .top p .icon-xiaochengxu-guanbi1 {
  color: white;
  font-size: 15px;
  font-weight: bold;
  vertical-align: middle;
}
/* 弹框内容 */
.main {
  width: 348px;
  height: 506px;
  background: white;
  position: absolute;
  left: 50%;
  top: 112px;
  border-radius: 26px;
  box-shadow: 0px 2px 6px 0px rgba(210, 167, 11, 100);
  overflow: hidden;
  transform: translateX(-50%);
}
/* 宝贝最爱 */
.main .title {
  width: 348px;
  height: 182px;
  background: #f5c92c;
  border-radius: 26px;
  position: relative;
  padding: 18px 10px;
  color: white;
  position: relative;
  overflow: hidden;
}
.main .title .img {
  position: absolute;
  bottom: 0;
  right: 0px;
  width: 199px;
}
/* 底部内容 */
.main .content {
  padding: 0 24px;
  position: relative;
  width: 100%;
  height: calc(100% - 182px);
}
/* 胡杨 */
.main .content .top {
  margin-top: 13px;
  overflow: hidden;
  vertical-align: middle;
}
.main .content .top img {
  width: 50px;
  vertical-align: middle;
}
.main .content .top span {
  margin-left: 15px;
  vertical-align: middle;
  font-size: 12px;
}
/* 美可玩故事 */
.main .content .center {
  color: #09cfb1;
}
.main .content .center h4 {
  font-size: 20px;
  margin: 17px 0 12px;
}
.main .content .center h5 {
  font-size: 14px;
  margin-bottom: 5px;
}
/* 二维码 */
.main .content .bottom {
  position: absolute;
  bottom: 30px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  padding-right: 40px;
}
.main .content .bottom div {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.main .content .bottom p {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-bottom: 10px;
}
.content .top img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
}
.main .content .bottom div:nth-of-type(1) p {
  border: solid 1px #23bb3d;
}
.main .content .bottom div:nth-of-type(2) p {
  border: solid 1px #f7d07c;
}
.main .content .bottom .iconfont {
  font-size: 24px;
  line-height: 50px;
}
.main .content .bottom .icon-weixin {
  color: #23bb3d;
}
.main .content .bottom .icon-xiazai {
  color: #f7d07c;
}
.main .content .bottom div span {
  font-size: 12px;
}
</style>